home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
cpphtp2.jar
/
preface.gml
< prev
next >
Wrap
Text File
|
1998-03-03
|
103KB
|
2,281 lines
<html>
<chapter>
<section type=Body name=Default title="Preface">
<page>
<font size=18 bold>Preface</font><hr>
Welcome to ANSI/ISO Draft Standard C++! This book
is by an old guy and a young guy. The old guy (HMD;
Massachusetts Institute of Technology 1967) has been
programming and/or teaching programming for 36
years. The young guy (PJD; MIT 1991) has been
programming for 15 years and has caught the teaching
and writing "bug." The old guy programs and teaches
from experience; the young guy does so from an
inexhaustible reserve of energy. The old guy wants
clarity; the young guy wants performance. The old guy
appreciates elegance and beauty; the young guy wants <br>
</page>
<page>
results. We got together to produce a book we hope you
will find informative, interesting, and entertaining.<br>
These are exciting times in the C++ community with
the impending approval of the ANSI/ISO C++ Draft
Standard. ANSI (the American National Standards
Institute) and ISO (the International Standards
Organization), have cooperated to develop what will
soon become one of the most important worldwide
standards for the computing community. <br>
When we wrote the first edition of<i> C++ How to
Program</i>, we aimed the book at college-level courses
which at the time were primarily being taught in Pascal
or C, emphasizing the procedural programming <br>
</page>
<page>
paradigm. Writing a C++ textbook for the Computer
Science I and II audiences presented a difficult
challenge to us. We would need to describe two
programming paradigms, both procedural programming
(because C++ still includes C) and object-oriented
programming. This practically doubled the amount of
material that would need to be presented at the
introductory level. We chose a strategy of presenting
the C-like material on primitive data types, control
structures, functions, arrays, pointers, strings and
structures in the first five chapters of the book We then
presented object-oriented programming in Chapters 6
through 15.<br>
</page>
<page>
<i>C++ How to Program</i> became the most widely used
college-level C++ textbook in the world. We delayed
writing this new edition for two reasons.<br>
1. C++ was under active development over this time
period, with new drafts of the standards document
appearing on a regular basis, but with no clear signs
from the standards committee that the draft standard
was going to be accepted "as is" within a short period
of time. Even as we go to press in November 1997,
there are estimates from the standards community that it
could be as much as a year or more before the current
draft standard is accepted worldwide.<br>
</page>
<page>
2. We were waiting for a key signal that it was time for
a new edition of <i>C++ How to Program</i>. That came in
July 1997 with the publication of Bjarne Stroustrup's
third edition of his book<i> The C++ Programming
Language</i>. Stroustrup created C++ and his books are
the definitive works on the language. At this point, we
felt that the "new definition" of C++ was sufficiently
stable for us to publish <i>C++ How to Program: Second
Edition</i>.<br>
We diverted our attention for a time to produce five
Java publications: The first and second editions of <i>Java
How to Program</i>, the first and second editions of our<i>
Java Multimedia Cyber Classroom</i> interactive learning <br>
</page>
<page>
software package for Windows 95/NT and Solaris, and
the first edition of<i> Java How to Program with an
Introduction to Visual J++</i> (which was sponsored by
Microsoft). But the excitement of the impending
acceptance of the ANSI/ISO C++ Draft Standard drew
our attention back to C++.<br>
</page>
</section>
<section type=Body name=Default title="C++ How to Program: Second Edition">
<page>
<font size=18 bold><i>C++ How to Program: Second Edition
</i></font><hr>
Let us describe for you the process we used to create
this book. Our computer science editor at Prentice Hall,
Laura Steele, retained 28 reviewers, including the
chairperson and several members of the ANSI/ISO C++
committee. A dozen of them reviewed the first edition
as published and made suggestions for improvement,
especially for bringing the book in line with the
evolving ANSI/ISO C++ Draft Standard. This process
resulted in more than 1000 pages of reviews! We then
wrote the new material addressing the enhancements to
C++ that were added in the ANSI/ISO C++ Draft <br>
</page>
<page>
Standard. We wrote "live-code" examples, ran the
programs, captured their screen outputs, and wrote the
accompanying program walkthroughs. Much of this
material was distributed throughout the 18 chapters of
the first edition. We then wrote three additional
chapters: Chapter 19, "Class <b>string</b> and String Stream
Processing;" Chapter 20, "Standard Template Library
(STL);" and Chapter 21, "ANSI/ISO C++ Standard
Language Additions." These chapters were sent to
reviewers and their comments were carefully
addressed. The STL chapter, in particular, was reviewed
by several members of the ANSI/ISO C++ Committee,
and by the creators of the STL, Alexander Stepanov and <br>
</page>
<page>
Meng Lee. C++ is in transition at the time of this
writing and few compilers are fully up to speed with the
new ANSI/ISO C++ Draft Standard. We made many
difficult judgement calls regarding the use of "current
version" C++ vs. new draft standard C++ features. <br>
</page>
</section>
<section type=Body name=Default title="A Revolution in Software Development">
<page>
<font size=18 bold>A Revolution in Software Development</font><hr>
For years hardware has been improving dramatically.
But software, for some reason, seemed to resist almost
every attempt to build it faster and to build it better.
Today we are in the middle of a revolution in the way
software is being written. That revolution is based on
the common-sense, hardware notion of standardized,
interchangeable components, exactly as used by Henry
Ford in the days of the Model T Ford. These software
components are called "objects," more properly,
"classes," which are the "cookie cutters" out of which
objects are produced.<br>
</page>
<page>
The most mature of the well-known object-oriented
languages is Smalltalk, developed in the early 1970s at
Xerox's Palo Alto Research Center. But the most
widely used object-oriented language--by a factor of
10 over Smalltalk--is C++ developed by Bjarne
Stroustrup and others in the early 1980s at AT&T. In the
time between the publication of the first edition of this
book and this new second edition, another serious
contender appeared on the scene--the Java object-
oriented programming language, developed in the early
1990s by James Gosling and others at Sun
Microsystems.<br>
</page>
<page>
Why a major new object-oriented programming
language every 10 years? Smalltalk was truly ahead of
its time as a research experiment. C++ was right for its
time and for today's high-performance systems
programming and applications development needs.
Java offered developers the ability to create highly
portable multimedia-intensive, and networking-
intensive Internet/World Wide Web-based applications. <br>
</page>
</section>
<section type=Body name=Default title="Procedural Programming, Object-Based Programming, Object-Oriented Programming and Generic Programming">
<page>
<font size=18 bold>Procedural Programming, Object-Based Programming, Object-Oriented Programming
and Generic Programming</font><hr>
In this book you will master the five key components of
C++ as well as four contemporary programming
paradigms (shown in italics in the following five
points).<br>
<spacer width=16 height=1>1. <i>C procedural programming</i>--Chapters 15 and 16
18; key topics include data types, control structures,
functions, arrays, pointers, strings, structures, bit
manipulation, character manipulation, preprocessing
and others.<br>
</page>
<page>
2.<i> C++ procedural programming</i> enhancements to C--
Sections 3.153.21; key topics include <b>inline</b> functions,
references, default arguments, function overloading and
function templates.<br>
<spacer width=16 height=1>3.<i> C++ object-based programming</i>--Chapters 68; key
topics include abstract data types, classes, objects,
encapsulation, information hiding, member access
control, constructors, destructors, software reusability,
constant objects and member functions, composition,
friendship, dynamic memory allocation, <b>static</b>
members, <b>this</b> pointer and others.<br>
<spacer width=16 height=1>4.<i> C++ object-oriented programming</i>--Chapters 915,
19 and 21; key topics include base classes, single <br>
</page>
<page>
inheritance, derived classes, multiple inheritance,
<b>virtual</b> functions, dynamic binding, polymorphism,
pure <b>virtual</b> functions, abstract classes, concrete
classes, stream input/output, class templates, exception
handling, file processing, data structures, strings as full-
fledged objects, data type <b>bool</b>, cast operators,
namespaces, run-time type information (RTTI), <b>explicit</b>
constructors and <b>mutable</b> members.<br>
<spacer width=16 height=1>5.<i> C++ generic programming</i>--Chapter 20--the
largest chapter in the book; key topics include the
Standard Template Library (STL), templatized
containers, sequence containers, associative containers,
container adaptors, iterators that traverse templatized <br>
</page>
<page>
containers and algorithms that process the elements of
templatized containers. <br>
</page>
</section>
<section type=Body name=Default title="Evolving from Pascal and C to C++">
<page>
<font size=18 bold>Evolving from Pascal and C to C++</font><hr>
C++ has replaced C as the systems implementation
language of choice in industry. But C programming will
continue to be an important and valuable skill for the
next decade because of the enormous amount of C
legacy code that must be maintained. Dr. Harvey M.
Deitel has been teaching introductory programming
courses in college environments for two decades with
an emphasis on developing clearly written, well-
structured programs. Much of what is taught in these
courses is the basic principles of programming with an
emphasis on the effective use of control structures and <br>
</page>
<page>
functionalization. We have presented this material
exactly the way HMD has done in his college courses.
There are some pitfalls, but where these occur, we point
them out and explain procedures for dealing with them
effectively. Our experience has been that students
handle the course in about the same manner as they
handle introductory Pascal or C courses. There is one
noticeable difference though: Students are highly
motivated by the fact that they are learning a leading-
edge language (C++) and a leading-edge programming
paradigm (object-oriented programming) that will be
immediately useful to them as they leave the college
environment. This increases their enthusiasm for the <br>
</page>
<page>
material--a big help when you consider that C++ is
more difficult to learn than Pascal or C.<br>
<spacer width=16 height=1>Our goal was clear: Produce a C++ programming
textbook for introductory college-level courses in
computer programming for students with little or no
programming experience, yet offer the depth and the
rigorous treatment of theory and practice demanded by
traditional, upper-level C++ courses. To meet these
goals, we produced a book larger than other C++
texts--this because our text also patiently teaches the
principles of procedural programming, object-based
programming, object-oriented programming and
generic programming. Hundreds of thousands of people <br>
</page>
<page>
have studied this material in academic courses and
professional seminars worldwide. <br>
</page>
</section>
<section type=Body name=Default title="Introducing Object Orientation from Chapter 1!">
<page>
<font size=18 bold>Introducing Object Orientation from Chapter
1!</font><hr>
We faced a difficult challenge in designing this book.
Should the book present a pure object-oriented
approach? Or should it present a hybrid approach
balancing procedural programming with object-
oriented programming?<br>
<spacer width=16 height=1>Many instructors who will teach from this text have
been teaching procedural programming (probably in C
or Pascal). C++ itself is not a purely object-oriented
language. Rather it is a hybrid language that enables <br>
</page>
<page>
both procedural programming and object-oriented
programming.<br>
<spacer width=16 height=1>So we chose the following approach. The first five
chapters of the book introduce procedural programming
in C++. They present computer concepts, control
structures, functions, arrays, pointers and strings. These
chapters cover the C components of C++ and the C++
"procedural enhancements" to C.<br>
<spacer width=16 height=1>We have done something to make these first five
chapters really unique. At the end of each of these
chapters, we have included a special section entitled,
"Thinking About Objects." These sections introduce
the concepts and terminology of object orientation to <br>
</page>
<page>
help students begin familiarizing themselves with what
objects are and how they behave.<br>
<spacer width=16 height=1>The Chapter 1 "Thinking About Objects" section
introduces the concepts and terminology of object
orientation. The sections in Chapters 2 through 5
present a requirements specification for a substantial
object-oriented system project, namely building an
elevator simulator, and carefully guide the student
through the typical phases of the object-oriented design
process. These sections discuss how to identify the
objects in a problem, how to specify the objects'
attributes and behaviors, and how to specify the
interactions among objects. By the time the student has <br>
</page>
<page>
finished Chapter 5, he or she has completed a careful
object-oriented design of the elevator simulator and is
ready--if not eager--to begin programming the
elevator in C++. Chapters 6 and 7 cover data
abstraction and classes. These chapters also contain
"Thinking About Objects" sections that ease students
through the various stages of programming their
elevator simulators in C++.<br>
</page>
</section>
<section type=Body name=Default title="About this Book">
<page>
<font size=18 bold>About this Book</font><hr>
<i>C++ How to Program</i> contains a rich collection of
examples, exercises, and projects drawn from many
fields to provide the student with a chance to solve
interesting real-world problems. The book concentrates
on the principles of good software engineering and
stresses program clarity. We avoid arcane terminology
and syntax specifications in favor of teaching by
example.<br>
<spacer width=16 height=1>This book is written by two educators who spend most
of their time teaching and writing about edge-of-the-
practice programming languages. <br>
</page>
<page>
The text places a strong emphasis on pedagogy. For
example, virtually every new concept of either C++ or
object-oriented programming is presented in the context
of a complete, working C++ program immediately
followed by a window showing the program's output.
Reading these programs is much like entering and
running them on a computer. We call this our "live-code
approach." <br>
<spacer width=16 height=1>Among the other pedagogical devices in the text are a
set of <i>Objectives</i> and an <i>Outline</i> at the beginning of
every chapter; <i>Common Programming Errors</i>, <i>Good
Programming Practices</i>, <i>Performance Tips</i>, <i>Portability
Tips</i>, <i>Software Engineering Observations</i> and <i>Testing
</i><br>
</page>
<page>
<i>and Debugging Tips</i> enumerated in each chapter and
summarized at the end of each chapter; comprehensive
bullet-list-style <i>Summary</i> and alphabetized <i>Terminology</i>
sections in each chapter; <i>Self-Review Exercises and
Answers</i> in each chapter; and the richest collection of
<i>Exercises</i> in any C++ book.<br>
<spacer width=16 height=1>The exercises range from simple recall questions to
lengthy programming problems to major projects.
Instructors requiring substantial term projects will find
many appropriate problems listed in the exercises for
Chapters 3 through 21. We have put a great deal of
effort into the exercises to enhance the value of this
course for the student. <br>
</page>
<page>
In writing this book, we have used a variety of C++
compilers running on Sun SPARC stations and IBM PC
compatibles (Borland(r) C++ Builder(tm), Microsoft(r)
Visual C++(r) 5.0 and Metrowerks(r) CodeWarrior
Professional(r)). For the most part, the programs in the
text will work on all these compilers with little or no
modification. We published the versions we developed
on Microsoft Visual C++ (with a few exceptions that
are noted in the text).<br>
<spacer width=16 height=1>This text is based on the C++ programming language as
defined by <i>Working Paper for Draft Proposed
International Standard for Information Systems--
</i><br>
</page>
<page>
<i>Programming Language C++</i>. Approval and technical
development work is being conducted by Accredited
Standards Committee X3, Information Technology and
its Technical Committee X3J16, Programming
Language C++, respectively. For further details,
contact: <br>
<font size=6><br></font><indent width=16><font size=14><i>X3 Secretariat</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>1250 Eye Street NW</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Washington DC 20005.</i></font></indent><font size=6><br></font>
This text is also based on the C programming language
as defined by The <i>American National Standard for
Programming Languages--C</i>: ANSI/ISO 9899-1990, <br>
</page>
<page>
Copyright 1990 by International Organization for
Standardization. Copies may be purchased directly
from The American National Standards Institute, 11
West 42nd Street, New York, NY 10036, Telephone:
(212) 642-4900, Fax: (212) 398-0023, <b>http://
www.ansi.org</b>.<br>
<spacer width=16 height=1>The serious programmer should read these documents
carefully and reference them regularly. These
documents are not tutorials. Rather they define C++ and
C with the extraordinary level of precision that
compiler implementors and "heavy-duty" developers
demand.<br>
</page>
<page>
We have carefully audited our presentation against
these documents. Our book is intended to be used at the
introductory and intermediate levels. We have not
attempted to cover every feature discussed in these
comprehensive documents.<br>
<font size=18><b>Objectives
</b></font><br>
Each chapter begins with a statement of objectives.
This tells the student what to expect and gives the
student an opportunity, after reading the chapter, to
determine if he or she has met these objectives. It is a
confidence builder and a source of positive
reinforcement.<br>
</page>
<page>
<font size=18><b>Quotations
</b></font><br>
The learning objectives are followed by a series of
quotations. Some are humorous, some are philosophical
and some offer interesting insights. Our students enjoy
relating the quotations to the chapter material. You may
appreciate some of the quotations more <i>after</i> reading
the chapters. <br>
<font size=18><b>Outline
</b></font><br>
The chapter outline helps the student approach the
material in top-down fashion. This, too, helps students
anticipate what is to come and set a comfortable and
effective learning pace. <br>
</page>
<page>
<font size=18><b>Sections
</b></font><br>
Each chapter is organized into small sections that
address key areas. We prefer a large number of small
sections.<br>
<font size=18><b>10,660 Lines of Code in 248 Example Programs
(with Program Outputs)
</b></font><br>
C++ features are presented in the context of complete,
working C++ programs. Each program is immediately
followed by a window containing the output produced
when the program is run. This enables the student to
confirm that the programs run as expected. Relating
outputs back to the program statements that produce
those outputs is an excellent way to learn and reinforce <br>
</page>
<page>
concepts. Our programs exercise the diverse features of
C++. Reading the book carefully is much like entering
and running these programs on a computer.<br>
<font size=18><b>152 Illustrations/Figures
</b></font><br>
An abundance of charts and line drawings is included.
The discussion of control structures in Chapter 3
features carefully drawn flowcharts. (Note: We do not
teach the use of flowcharting as a program development
tool, but we do use brief flowchart-oriented
presentation to specify the precise operation of C++'s
control structures.) Chapter 15, "Data Structures," uses
line drawings to illustrate the creation and maintenance <br>
</page>
<page>
of linked lists, queues, stacks, and binary trees. The rest
of the book is abundantly illustrated.<br>
<font size=18><b>621 Programming Tips</b> </font><br>
We have included six design elements to help students
focus on important aspects of program development,
testing and debugging, performance, and portability.
We highlight hundreds of these tips in the form of <i>Good
Programming Practices</i>, <i>Common Programming
Errors</i>, <i>Performance Tips</i>, <i>Portability Tips</i>, <i>Software
Engineering Observations</i> and <i>Testing and Debugging
Tips</i>. These tips and practices represent the best we
have been able to glean from a combined five decades
of programming and teaching experience. One of our <br>
</page>
<page>
students--a mathematics major--told us recently that
she feels this approach is somewhat like the
highlighting of axioms, theorems, and corollaries in
mathematics books; it provides a basis on which to
build good software.<br>
<font size=18><b>115 Good Programming Practices
</b></font><br>
<i>Good Programming Practices</i> are highlighted in the
text. They call the student's attention to techniques that
help produce better programs. When we teach
introductory courses to nonprogrammers, we state that
the "buzzword" of the course is "clarity," and we tell
the students that we will highlight (in these <i>Good
Programming Practices</i>) techniques for writing <br>
</page>
<page>
programs that are clearer, more understandable and
more maintainable.<br>
<font size=18><b>210 Common Programming Errors
</b></font><br>
Students learning a language--especially in their first
programming course--tend to make certain kinds of
errors frequently. Focusing the students' attention on
these <i>Common Programming Errors</i> helps the student
avoid making the same errors. It also helps reduce the
long lines outside instructors' offices during office
hours! Some of these errors are not so common, but we
did not want to add another tip category.<br>
</page>
<page>
<font size=18><b>88 Performance Tips
</b></font><br>
In our experience, teaching students to write clear and
understandable programs is by far the most important
goal for a first programming course. But students want
to write the programs that run the fastest, use the least
memory, require the smallest number of keystrokes, or
dazzle in other nifty ways. Students really care about
performance. They want to know what they can do to
"turbo charge" their programs. So we have include
<i>Performance Tips</i> to highlight opportunities for
improving program performance.<br>
</page>
<page>
<font size=18><b>35 Portability Tips
</b></font><br>
Software development is a complex and expensive
activity. Organizations that develop software must often
produce versions customized to a variety of computers
and operating systems. So there is a strong emphasis
today on portability, i.e., on producing software that
will run on a variety of computer systems with few, if
any, changes. Many people tout C++ as an appropriate
language for developing portable software, especially
because of C++'s close relationship to ANSI/ISO C and
the fact that the ANSI/ISO C++ Draft Standard will
soon be accepted as the global C++ standard. Some
people assume that if they implement an application in <br>
</page>
<page>
C++, the application will automatically be portable.
This is simply not the case. Achieving portability
requires careful and cautious design. There are many
pitfalls. We include numerous <i>Portability Tips</i> to help
students write portable code.<br>
<font size=18><b>147 Software Engineering Observations
</b></font><br>
The object-oriented programming paradigm requires a
complete rethinking about the way we build software
systems. C++ is an effective language for performing
good software engineering. The <i>Software Engineering
Observations</i> highlight techniques, architectural issues,
and design issues, etc. that affect the architecture and
construction of software systems, especially large-scale <br>
</page>
<page>
systems. Much of what the student learns here will be
useful in upper-level courses and in industry as the
student begins to work with large, complex real-world
systems<br>
<font size=18><b>26 Testing and Debugging Tips
</b></font><br>
This "tip type" may be misnamed. When we decided to
incorporate <i>Testing and Debugging Tips</i> into this new
edition, we thought these tips would be suggestions for
testing programs to expose bugs and suggestions for
removing those bugs. In fact, most of these tips tend to
be observations about capabilities and features of C++
that prevent bugs from getting into programs in the first
place. <br>
</page>
<page>
<font size=18><b>Summary
</b></font><br>
Each chapter ends with additional pedagogical devices.
We present an extensive, bullet-liststyle <i>Summary</i> of
the chapter. This helps the student review and reinforce
key concepts. There is an average of 38 summary
bullets per chapter.<br>
<font size=18><b>Terminology
</b></font><br>
We include a <i>Terminology</i> section with an alphabetized
list of the important terms defined in the chapter--
again, further confirmation. There is an average of 66
terms per chapter.<br>
</page>
<page>
<font size=18><b>Summary of Tips, Practices, and Errors
</b></font><br>
We collect and list from the chapter the <i>Good
Programming Practices</i>, <i>Common Programming
Errors</i>, <i>Performance Tips</i>, <i>Portability Tips</i>, <i>Software
Engineering Observations</i> and<i> Testing and Debugging
Tips</i>.<br>
<font size=18><b>559 Self-Review Exercises and Answers (Count
Includes Separate Parts)
</b></font><br>
Extensive <i>Self-Review Exercises</i> and <i>Answers to Self-
Review Exercises</i> are included for self-study. This gives
the student a chance to build confidence with the
material and prepare to attempt the regular exercises.<br>
</page>
<page>
<font size=18><b>862 Exercises (Count Includes Separate Parts; 1421
Total Exercises)
</b></font><br>
Each chapter concludes with a substantial set of
exercises including simple recall of important
terminology and concepts; writing individual C++
statements; writing small portions of C++ functions and
classes; writing complete C++ functions, classes, and
programs; and writing major term projects. The large
number of exercises enables instructors to tailor their
courses to the unique needs of their audiences and to
vary course assignments each semester. Instructors can
use these exercises to form homework assignments,
short quizzes, and major examinations. <br>
</page>
<page>
<font size=18><b>500-page Instructor's Manual with Solutions to the
Exercises
</b></font><br>
The solutions for the exercises are included in the
<i>Instructor's Manual</i> and on the disks <i>available only to
instructors</i> through their Prentice-Hall representatives.
<b>[NOTE: Please do not write to us requesting the
instructor's manual. Distribution of this publication
is strictly limited to college professors teaching from
the book. Instructors may obtain the solutions
manual only from their regular Prentice Hall
representatives.] </b>Solutions to approximately half of
the exercises are included on the <i>C & C++ Multimedia
Cyber Classroom: Second Edition </i>CD (available March <br>
</page>
<page>
1998 in bookstores and computer stores; please see the
last few pages of this book for ordering instructions).<br>
<font size=18>4372 Index Entries (Total of 7801 Counting Multiple References) </font><br>
We have included an extensive <i>Index</i> at the back of the
book. This helps the student find any term or concept
by keyword. The <i>Index</i> is useful to people reading the
book for the first time and is especially useful to
practicing programmers who use the book as a
reference. Most of the terms in the <i>Terminology</i>
sections appear in the <i>Index</i> (along with many more
index items from each chapter). Thus, the student can
use the <i>Index</i> in conjunction with the <i>Terminology</i> <br>
</page>
<page>
sections to be sure he or she has covered the key
material of each chapter.<br>
</page>
</section>
<section type=Body name=Default title="A Tour of the Book">
<page>
<font size=18 bold>A Tour of the Book</font><hr>
The book is divided into several major parts. The first
part, Chapters 1 through 5, presents a thorough
treatment of procedural programming in C++ including
data types, input/output, control structures, functions,
arrays, pointers, and strings.<br>
<spacer width=16 height=1>The second part, Chapters 6 through 8, presents a
substantial treatment of data abstraction with classes,
objects, and operator overloading. This section might
effectively be called, "Programming with Objects."<br>
</page>
<page>
The third part, Chapters 9 and 10, presents inheritance,
virtual functions, and polymorphism--the root
technologies of true object-oriented programming.<br>
<spacer width=16 height=1>The fourth part, chapters 11 and 14, presents C++-style
stream-oriented input/output including using stream I/O
with the keyboard, the screen, files, and character
arrays; both sequential file processing and direct-access
(i.e., random access) file processing are discussed.<br>
<spacer width=16 height=1>The fifth part, Chapters 12 and 13, discusses two of the
more recent major additions to C++, namely templates
and exception handling. Templates, also called
parameterized types, encourage software reusability.
Exceptions help programmers develop more robust, <br>
</page>
<page>
fault-tolerant, business-critical and mission-critical
systems.<br>
<spacer width=16 height=1>The sixth part, Chapter 15, presents a thorough
treatment of dynamic data structures such as linked
lists, queues, stacks, and trees. This chapter, when
supplemented with the treatment of the Standard
Template Library in Chapter 20, creates a rich treatment
of data structures that makes a nice C++ supplement to
traditional computer science data structures and
algorithms courses.<br>
<spacer width=16 height=1>The seventh part, Chapters 16 through 18 discuss a
variety of topics including bit, character and string <br>
</page>
<page>
manipulation; the preprocessor, and miscellaneous
"Other Topics."<br>
<spacer width=16 height=1>The last part of the main text, Chapters 19 through 21,
is devoted to the latest enhancements to C++ and to the
C++ Standard Library which have been included in the
ANSI/ISO C++ Draft Standard. These include
discussions of class <tt><b>string</b></tt>, string stream processing,
the Standard Template Library (STL), and a potpourri
of other recent additions to C++.<br>
<spacer width=16 height=1>The end matter of the book consists of reference
materials that support the main text including
Appendices on operator precedence, the ASCII
character set, number systems (binary, decimal, octal <br>
</page>
<page>
and hexadecimal) and C++ Internet/World Wide Web
resources. An extensive bibliography is included to
encourage further reading. The text concludes with a
detailed index that helps the reader locate any terms in
the text by keyword. Now let us look at each of the
chapters in detail.<br>
<font size=18><b>Chapter 1--Introduction to Computers and C++
Programming--
</b></font><br>
discusses what computers are, how they work, and how
they are programmed. It introduces the notion of
structured programming and explains why this set of
techniques has fostered a revolution in the way
programs are written. The chapter gives a brief history <br>
</page>
<page>
of the development of programming languages from
machine languages, to assembly languages, to high-
level languages. The origin of the C++ programming
language is discussed. The chapter includes an
introduction to a typical C++ programming
environment and gives a concise introduction to writing
C++ programs. A detailed treatment of decision making
and arithmetic operations in C++ is presented. After
studying this chapter, the student will understand how
to write simple, but complete, C++ programs. We
discuss the explosion in interest in the Internet that has
occurred with the advent of the World Wide Web and
the Java programming language. We discuss <br>
</page>
<page>
<b>namespaces</b> and the <b>using</b> statement for the benefit of
readers with access to draft-standard-compliant
compilers. We continue to use the "old-style" header
files in the early chapters of this edition; we use the new
style headers later in the book where the bulk of the
new C++ material appears. It will take a few years to
"clear out" the older compilers that are still widely
used. Readers wishing to plunge right in with object-
orientation, should read the "Thinking About Objects"
section which introduces the basic terminology of
object technology.<br>
</page>
<page>
<font size=18><b>Chapter 2--Control Structures--
</b></font><br>
introduces the notion of algorithms (procedures) for
solving problems. It explains the importance of using
control structures effectively in producing programs
that are understandable, debuggable, maintainable and
more likely to work properly on the first try. It
introduces the sequence structure, selection structures
(<b>if</b>, <b>if/else</b> and <b>switch</b>) and repetition structures (<b>while</b>,
<b>do/while</b> and <b>for</b>). It examines repetition in detail, and
compares the alternatives of counter-controlled loops
and sentinel-controlled loops. It explains the technique
of top-down, stepwise refinement that is critical to the
production of properly structured programs, and <br>
</page>
<page>
presents the popular program design aid, pseudocode.
The methods and approaches used in Chapter 2 are
applicable to effective use of control structures in any
programming language, not just C++. This chapter
helps the student develop good programming habits in
preparation for dealing with the more substantial
programming tasks in the remainder of the text. The
chapter concludes with a discussion of logical
operators--<b>&&</b> (and), <b>||</b> (or) and <b>!</b> (not). The keyword
chart has been enhanced with the new keywords. We
introduce the new-style <b>static_cast</b> operator. This is
safer than using the old-style casting C++ inherited
from C. We added the "Peter Minuit" exercise so <br>
</page>
<page>
students can see the wonders of compound interest--
with the computer doing most of the work! We have
introduced a new, more open, easier to read "look and
feel" for our C++ source programs. We have tuned the
elevator case study. Our readers who attempt this
detailed case study tell us that it ties the concepts
together nicely. We discuss the new scoping rules for
loop counters in <b>for</b>-loops.<br>
<font size=18><b>Chapter 3--Functions--
</b></font><br>
discusses the design and construction of program
modules. C++'s function-related capabilities include
standard library functions, programmer-defined
functions, recursion, call-by-value and call-by-<br>
</page>
<page>
reference capabilities. The techniques presented in
Chapter 3 are essential to the production of properly
structured programs, especially the kinds of larger
programs and software that system programmers and
application programmers are likely to develop in real-
world applications. The "divide and conquer" strategy
is presented as an effective means for solving complex
problems by dividing them into simpler interacting
components. Students enjoy the treatment of random
numbers and simulation, and they appreciate the
discussion of the dice game craps which makes elegant
use of control structures. The chapter offers a solid
introduction to recursion and includes a table <br>
</page>
<page>
summarizing the dozens of recursion examples and
exercises distributed throughout the remainder of the
book. Some texts leave recursion for a chapter late in
the book; we feel this topic is best covered gradually
throughout the text. The extensive collection of 60
exercises at the end of the chapter includes several
classical recursion problems such as the Towers of
Hanoi. The chapter discusses the so-called "C++
enhancements to C," including <b>inline</b> functions,
reference parameters, default arguments, the unary
scope resolution operator, function overloading, and
function templates. The header files chart has been
modified to include many of the new header files that <br>
</page>
<page>
the reader will use throughout the book. Please do
exercise 3.54 on adding a wagering capability to the
craps program. And be sure to do the "Thinking About
Objects" section which guides you through determining
the attributes (i.e., data) that the classes in your elevator
simulator will need.<br>
<font size=18><b>Chapter 4--Arrays--
</b></font><br>
discusses the structuring of data into arrays, or groups,
of related data items of the same type. The chapter
presents numerous examples of both single-subscripted
arrays and double-subscripted arrays. It is widely
recognized that structuring data properly is just as
important as using control structures effectively in the <br>
</page>
<page>
development of properly structured programs.
Examples in the chapter investigate various common
array manipulations, printing histograms, sorting data,
passing arrays to functions, and an introduction to the
field of survey data analysis (with simple statistics). A
feature of this chapter is the discussion of elementary
sorting and searching techniques and the presentation of
binary searching as a dramatic improvement over linear
searching. The 38 end-of-chapter exercises include a
variety of interesting and challenging problems such as
improved sorting techniques, the design of an airline
reservations system, an introduction to the concept of
turtle graphics (made famous in the LOGO language), <br>
</page>
<page>
and the Knight's Tour and Eight Queens problems that
introduce the notion of heuristic programming so
widely employed in the field of artificial intelligence.
The exercises conclude with 8 recursion problems
including the selection sort, palindromes, linear search,
binary search, the eight queens, printing an array,
printing a string backwards, and finding the minimum
value in an array. This chapter still uses C-style arrays
which, as you will see in Chapter 5, are really pointers
to the array contents in memory. We are certainly
committed to arrays as full-fledged objects. In Chapter
8, we use the techniques of operator overloading to
craft a valuable <b>Array</b> class out of which we create <br>
</page>
<page>
<b>Array</b> objects that are much more robust and pleasant
to program with than the arrays of Chapter 4. In
Chapter 20, "Standard Template Library (STL)," we
introduce STL's class <b>vector</b> which, when used with the
iterators and algorithms discussed in Chapter 20,
creates a solid treatment of arrays as full-fledged
objects. The "Thinking About Objects" section guides
you through determining the behaviors (i.e., functions)
of the classes in your elevator simulator.<br>
<font size=18><b>Chapter 5--Pointers and Strings--
</b></font><br>
presents one of the most powerful and difficult-to-
master features of the C++ language, namely pointers.
The chapter provides detailed explanations of pointer <br>
</page>
<page>
operators, call by reference, pointer expressions,
pointer arithmetic, the relationship between pointers
and arrays, arrays of pointers, and pointers to functions.
There is an intimate relationship between pointers,
arrays, and strings in C++, so we introduce basic string-
manipulation concepts and include a discussion of some
of the most popular string-handling functions, namely
<b>getline</b> (input a line of text), <b>strcpy</b> and <b>strncpy</b> (copy
a string), <b>strcat</b> and <b>strncat</b>, (concatenate two strings)
<b>strcmp</b> and <b>strncmp</b> (compare two strings), <b>strtok</b>
("tokenize" a string into its pieces), and <b>strlen</b>
(compute the length of a string). The 49 chapter
exercises include a simulation of the classic race <br>
</page>
<page>
between the tortoise and the hare, card shuffling and
dealing algorithms, recursive quicksort, and recursive
maze traversals. A special section entitled "Building
Your Own Computer" is also included. This section
explains machine-language programming and proceeds
with a project involving the design and implementation
of a computer simulator that allows the reader to write
and run machine language programs. This unique
feature of the text will be especially useful to the reader
who wants to understand how computers really work.
Our students enjoy this project and often implement
substantial enhancements; many enhancements are
suggested in the exercises. In Chapter 15, another <br>
</page>
<page>
special section guides the reader through building a
compiler; the machine language produced by the
compiler is then executed on the machine language
simulator produced in Chapter 7. Information is
communicated from the compiler to the simulator in
sequential files which we discuss in Chapter 14. A
second special section includes challenging string-
manipulation exercises related to text analysis, word
processing, printing dates in various formats, check
protection, writing the word equivalent of a check
amount, Morse Code, and metric-to-English
conversions. The reader will want to revisit these
string-manipulation exercises after studying class <br>
</page>
<page>
<b>string</b> in Chapter 19. Many people find that the topic of
pointers is, by far, the most difficult part of an
introductory programming course. In C and "raw C++"
arrays and strings are really pointers to array and string
contents in memory. Even function names are pointers.
Studying this chapter carefully should reward you with
a deep understanding of the complex topic of pointers.
Again, we cover arrays and strings as full-fledged
objects later in the book. In Chapter 8, we use operator
overloading to craft customized <b>Array</b> and <b>String</b>
classes. In Chapter 19, we discuss Standard Library
class <b>string</b> and show how to manipulate <b>string</b>
objects. In Chapter 20 we discuss class <b>vector</b>. Chapter <br>
</page>
<page>
5 is loaded with challenging exercises. Please be sure to
try the <i>Special Section: Building Your Own Computer</i>.
The "Thinking About Objects" section guides you
through determining the collaborations among the
classes in your elevator simulator.<br>
<font size=18><b>Chapter 6--Classes and Data Abstraction--
</b></font><br>
begins our discussion of object-based programming.
The chapter represents a wonderful opportunity for
teaching data abstraction the "right way"--through a
language (C++) expressly devoted to implementing
abstract data types (ADTs). In recent years, data
abstraction has become a major topic in introductory
computing courses. Chapters 6, 7, and 8 include a solid <br>
</page>
<page>
treatment of data abstraction. Chapter 6 discusses
implementing ADTs as <b>struct</b>s, implementing ADTs as
C++-style <b>classes</b> and why this approach is superior to
using<b> struct</b>s, accessing <b>class</b> members, separating
interface from implementation, using access functions
and utility functions, initializing objects with
constructors, destroying objects with destructors,
assignment by default memberwise copy, and software
reusability. The chapter exercises challenge the student
to develop classes for complex numbers, rational
numbers, times, dates, rectangles, huge integers, and for
playing tic-tac-toe. Students generally enjoy game-
playing programs. The "Thinking About Objects" <br>
</page>
<page>
section now asks you to write a class header file and
member function definition source files for each of the
classes in your elevator simulator. It outlines the
operation of a driver program to run your simulator, and
suggests some useful outputs. The more mathematically
inclined reader will enjoy the exercises on creating
class <b>Complex</b> (for complex numbers), class <b>Rational</b>
(for rational numbers) and class <b>HugeInteger</b> (for
arbitrarily large integers).<br>
newtitle
<b>Chapter 7--Classes Part II--
</b>
<b><b>Chapter 7--Classes Part II--
</b></b><br>
continues the study of classes and data abstraction. The
chapter discusses declaring and using constant objects,
constant member functions, composition--the process <br>
</page>
<page>
of building classes that have objects of other classes as
members, <b>friend</b> functions and <b>friend</b> classes that have
special access rights to the <b>private</b> and <b>protected</b>
members of classes, the <b>this</b> pointer that enables an
object to know its own address, dynamic memory
allocation, <b>static</b> class members for containing and
manipulating class-wide data, examples of popular
abstract data types (arrays, strings, and queues),
container classes, and iterators. The chapter exercises
ask the student to develop a savings account class and a
class for holding sets of integers. In our discussion of
<b>const</b> objects, we briefly mention the new keyword
<b>mutable</b> which, as we will see in Chapter 21, is used in <br>
</page>
<page>
a subtle manner to enable modification of non-visible"
implementation in <b>const</b> objects. We discuss dynamic
memory allocation with <b>new</b> and <b>delete</b>. When <b>new</b>
fails, it returns a 0 pointer in old-style C++. We use this
old style in Chapters 7-12. We defer to Chapter 13 the
discussion of the new style of <b>new</b> failure in which <b>new</b>
now "throws an exception." We have added to the
discussion of <b>static</b> class members a video-game-based
motivating example. We emphasize throughout the
book and in our professional seminars how important it
is to hide implementation details from clients of a class.
Then, we show <b>private</b> data on our class headers,
which certainly reveals implementation. We have <br>
</page>
<page>
introduced a new section on proxy classes, a nice means
of hiding even <b>private</b> data from clients of a class. The
"Thinking About Objects" section asks you to
incorporate dynamic memory management and
composition into your elevator simulator. Students will
enjoy the exercise creating class <b>Integerset</b>. This serves
as excellent motivation for the treatment of operator
overloading in Chapter 8.<br>
<font size=18><b>Chapter 8--Operator Overloading--
</b></font><br>
is one of the most popular topics in our C++ courses.
Students really enjoy this material. They find it a
perfect match with the discussion of abstract data types
in Chapters 6 and 7. Operator overloading enables the <br>
</page>
<page>
programmer to tell the compiler how to use existing
operators with objects of new types. C++ already
knows how to use these operators with objects of built-
in types such as integers, floats, and characters. But
suppose we create a new string class. What does the
plus sign mean? Many programmers use plus with
strings to mean concatenation. In Chapter 8, the
programmer will learn how to "overload" the plus sign
so that when it is written between two string objects in
an expression, the compiler will generate a function call
to an "operator function" that will concatenate the two
strings. The chapter discusses the fundamentals of
operator overloading, restrictions in operator <br>
</page>
<page>
overloading, overloading with class member functions
vs. with nonmember functions, overloading unary and
binary operators, and converting between types. A
feature of the chapter is the collection of substantial
case studies including an array class, a string class, a
date class, a huge integers class, and a complex
numbers class (the last two appear with full source code
in the exercises). The more mathematically inclined
student will enjoy creating the polynomial class in the
exercises. We find the students really enjoy this
material. It is different from what you do in most
programming languages and courses. Operator
overloading is a complex topic, but an enriching one. <br>
</page>
<page>
Using operator overloading wisely helps you add that
extra "polish" to your classes. The discussions of class
<b>Array</b> and class <b>String</b> are particularly valuable to
students who will go on to use the Standard Library
classes <b>string</b> and <b>vector</b>. With the techniques of
Chapters 6, 7 and 8, it is possible to craft a <b>Date</b> class
that, if we had been using it for the last two decades,
could easily have eliminated a major portion of the so-
called "Year 2000 Problem." The exercises encourage
the student to add operator overloading to classes
<b>Complex</b>, <b>Rational</b>, and <b>HugeInteger</b> to enable
convenient manipulation of objects of these classes
with operator symbols--as in mathematics--rather than <br>
</page>
<page>
with function calls as the student did in the Chapter 7
exercises.<br>
<font size=18><b>Chapter 9--Inheritance--
</b></font><br>
deals with one of the most fundamental capabilities of
object-oriented programming languages. Inheritance is
a form of software reusability in which new classes are
developed quickly and easily by absorbing the
capabilities of existing classes and adding appropriate
new capabilities. The chapter discusses the notions of
base classes and derived classes, <b>protected</b> members,
<b>public</b> inheritance, <b>protected</b> inheritance, <b>private</b>
inheritance, direct base classes, indirect base classes,
constructors and destructors in base classes and derived <br>
</page>
<page>
classes, and software engineering with inheritance. The
chapter compares inheritance ("is a" relationships) with
composition ("has a" relationships) and introduces
"uses a" and "knows a" relationships. A feature of the
chapter is its several substantial case studies. In
particular, a lengthy case study implements a point,
circle, cylinder class hierarchy. The chapter concludes
with a case study on multiple inheritance--an advanced
feature of C++ that enables a derived class to be formed
by inheriting attributes and behaviors from several base
classes. The exercises ask the student to compare the
creation of new classes by inheritance vs. composition;
to extend the various inheritance hierarchies discussed <br>
</page>
<page>
in the chapter; to write an inheritance hierarchy for
quadrilaterals, trapezoids, parallelograms, rectangles,
and squares; and to create a more general shape
hierarchy with two-dimensional shapes and three-
dimensional shapes. We modified our inheritance
hierarchy for the university community members to
show a nice example of multiple inheritance. In Chapter
21 we continue our discussion of multiple inheritance
by exposing the problems caused by so-called
"diamond inheritance" and showing how to solve these
problems with <b>virtual</b> base classes.<br>
</page>
<page>
<font size=18><b>Chapter 10--Virtual Functions and Polymorphism--
</b></font><br>
deals with another of the fundamental capabilities of
object-oriented programming, namely polymorphic
behavior. When many classes are related through
inheritance to a common base class, each derived-class
object may be treated as a base-class object. This
enables programs to be written in a general manner
independent of the specific types of the derived-class
objects. New kinds of objects can be handled by the
same program, thus making systems more extensible.
Polymorphism enables programs to eliminate complex
<b>switch</b> logic in favor of simpler "straight-line" logic. A <br>
</page>
<page>
screen manager of a video game, for example, can
simply send a draw message to every object in a linked
list of objects to be drawn. Each object knows how to
draw itself. A new object can be added to the program
without modifying that program as long as that new
object also knows how to draw itself. This style of
programming is typically used to implement today's
popular graphical user interfaces (GUIs). The chapter
discusses the mechanics of achieving polymorphic
behavior through the use of <b>virtual</b> functions. It
distinguishes between abstract classes (from which
objects cannot be instantiated) and concrete classes
(from which objects can be instantiated). Abstract <br>
</page>
<page>
classes are useful for providing an inheritable interface
to classes throughout the hierarchy. A feature of the
chapter is its two major polymorphism case studies--a
payroll system and another version of the point, circle,
cylinder shape hierarchy discussed in Chapter 9. The
chapter exercises ask the student to discuss a number of
conceptual issues and approaches, add abstract classes
to the shape hierarchy, develop a basic graphics
package, modify the chapter's employee class--and
pursue all these projects with <b>virtual</b> functions and
polymorphic programming. The chapter's two
polymorphism case studies show a contrast in
inheritance styles. The first example (of a payroll <br>
</page>
<page>
system) is a clear, "sensible" use of inheritance. The
second, which builds on the point, circle, cylinder
hierarchy developed in Chapter 9, is an example of
what some professionals call "structural inheritance"--
not as natural and sensible as the first, but
"mechanically correct" nevertheless. We decided to
keep this second example because of the new section
we added in this edition, entitled "Polymorphism,
<b>virtual</b> Functions and Dynamic Binding "Under the
Hood." We deliver our C++ professional seminars to
senior software engineers. These people appreciated the
two polymorphism examples in the first edition, but
they felt something was missing from our presentations. <br>
</page>
<page>
Yes, they said, we showed them how to program with
polymorphism in C++. But they wanted more. They
told us they were concerned about the operating
overhead of programming polymorphically. It's a nice
feature, they said, but it clearly has costs. So our
professional audiences insisted that we provide a deeper
explanation that showed precisely how polymorphism
is implemented in C++, and hence, precisely what
execution time and memory "costs" one must pay when
programming with this powerful capability. We
responded by developing an illustration that shows the
<i>vtables</i> (<b>virtual</b> function tables) the C++ compiler
automatically builds to support the polymorphic <br>
</page>
<page>
programming style. We drew these tables in our classes
in which we discussed the point, circle, cylinder shape
hierarchy. Our audiences indicated that this indeed gave
them the information to decide whether polymorphism
was an appropriate programming style for each new
project they would tackle. We have included this
presentation in Section 10.10 and the <i>vtable</i> illustration
in Fig. 10.2. Please study this presentation carefully. It
will give you a much deeper understanding of what's
really occurring in the computer when you program
with inheritance and polymorphism.<br>
</page>
<page>
<font size=18><b>Chapter 11--C++ Stream Input/Output--
</b></font><br>
contains a comprehensive treatment of the new object-
oriented style of input/output introduced in C++. The
chapter discusses the various I/O capabilities of C++
including output with the stream insertion operator,
input with the stream extraction operator, type-safe I/O
(a nice improvement over C), formatted I/O,
unformatted I/O (for performance), stream
manipulators for controlling the stream base (decimal,
octal, or hexadecimal), floating-point numbers,
controlling field widths, user-defined manipulators,
stream format states, stream error states, I/O of objects
of user-defined types, and tying output streams to input <br>
</page>
<page>
streams (to ensure that prompts actually appear before
the user is expected to enter responses). The extensive
exercise set asks the student to write various programs
that test most of the I/O capabilities discussed in the
text.<br>
<font size=18><b>Chapter 12--Templates--
</b></font><br>
discusses one of the more recent additions to the
evolving C++ language. Function templates were
introduced in Chapter 3. Chapter 12 presents an
additional function template example. Class templates
enable the programmer to capture the essence of an
abstract data type (such as a stack, an array, or a queue)
and then create--with minimal additional code--<br>
</page>
<page>
versions of that ADT for particular types (such as a
queue of <b>int</b>, a queue of <b>float</b>, a queue of strings, etc.).
For this reason, template classes are often called
parameterized types. The chapter discusses using type
parameters and nontype parameters and considers the
interaction among templates and other C++ concepts,
such as inheritance, <b>friends</b>, and <b>static</b> members. The
exercises challenge the student to write a variety of
function templates and class templates, and to employ
these in complete programs. We did not add anything to
Chapter 12 in this edition, but we have greatly
enhanced the treatment of templates with the discussion <br>
</page>
<page>
of the Standard Template Library (STL) containers,
iterators and algorithms in (102-page) Chapter 20.<br>
<font size=18><b>Chapter 13--Exception Handling--
</b></font><br>
discusses one of the more recent enhancements to the
C++ language. Exception handling enables the
programmer to write programs that are more robust,
more fault tolerant, and more appropriate for business-
critical and mission-critical environments. The chapter
discusses when exception handling is appropriate;
introduces the basics of exception handling with <b>try</b>
blocks, <b>throw</b> statements, and <b>catch</b> blocks; indicates
how and when to rethrow an exception; explains how to
write an exception specification and process <br>
</page>
<page>
unexpected exceptions; and discusses the important ties
between exceptions and constructors, destructors, and
inheritance. A feature of the chapter is its 43 exercises
that walk the student through implementing programs
that illustrate the diversity and power of C++'s
exception handling capabilities. We added the "live-
code" example of Fig. 13.2 on rethrowing an exception
and another "live-code" example in Fig. 13.3 on stack
unwinding. We added a pair of examples in Fig. 13.4
and Fig. 13.5 illustrating both ways <b>new</b> can fail when
memory is exhausted. Prior to the C++ draft standard
<b>new</b> fails by returning 0, much as <b>malloc</b> fails in C by
returning a <b>NULL</b> pointer value--this is shown in Fig. <br>
</page>
<page>
13.4. Figure 13.5 shows the new style of <b>new</b> failing by
throwing a <b>bad_alloc</b> (bad allocation) exception. We
added the example of Fig. 13.6 illustrating how to use
<b>set_new_handler</b> to specify a custom function to be
called to deal with memory exhaustion situations. We
added section 13.15 which discusses the new <b>auto_ptr</b>
class template to guarantee that dynamically allocated
memory will be properly<b> delete</b>d to avoid memory
leaks. We added a discussion of the new Standard
Library Exception Hierarchy in section 13.16<br>
<font size=18><b>Chapter 14--File Processing--
</b></font><br>
discusses the techniques used to process text files with
sequential access and random access. The chapter <br>
</page>
<page>
begins with an introduction to the data hierarchy from
bits, to bytes, to fields, to records, to files. Next, C++'s
simple view of files and streams is presented.
Sequential-access files are discussed using a series of
three programs that show how to open and close files,
how to store data sequentially in a file, and how to read
data sequentially from a file. Random-access files are
discussed using a series of four programs that show
how to sequentially create a file for random access, how
to read and write data to a file with random access, and
how to read data sequentially from a randomly accessed
file. The fourth random-access program combines
many of the techniques of accessing files both <br>
</page>
<page>
sequentially and randomly into a complete transaction-
processing program. Students in our industry seminars
have told us that after studying the material on file
processing, they were able to produce substantial file-
processing programs that were immediately useful in
their organizations. The exercises ask the student to
implement a variety of programs that build and process
both sequential-access files and random-access files.
We thinned out Chapter 14 a bit by removing the
material on String Stream Processing. That material has
been rewritten and more appropriately positioned at the
end of Chapter 19.<br>
</page>
<page>
<font size=18><b>Chapter 15--Data Structures--
</b></font><br>
discusses the techniques used to create and manipulate
dynamic data structures. The chapter begins with
discussions of self-referential classes and dynamic
memory allocation. The chapter proceeds with a
discussion of how to create and maintain various
dynamic data structures including linked lists, queues
(or waiting lines), stacks, and trees. For each type of
data structure, we present complete, working programs
and show sample outputs. The chapter really helps the
student master pointers. The chapter includes abundant
examples using indirection and double indirection--a
particularly difficult concept. One problem when <br>
</page>
<page>
working with pointers is that students have trouble
visualizing the data structures and how their nodes are
linked together. So we have included illustrations that
show the links and the sequence in which they are
created. The binary tree example is a superb capstone
for the study of pointers and dynamic data structures.
This example creates a binary tree; enforces duplicate
elimination; and introduces recursive preorder, inorder,
and postorder tree traversals. Students have a genuine
sense of accomplishment when they study and
implement this example. They particularly appreciate
seeing that the inorder traversal prints the node values
in sorted order. The chapter includes a substantial <br>
</page>
<page>
collection of exercises. A highlight of the exercises is
the special section "Building Your Own Compiler." The
exercises walk the student through the development of
an infix-to-postfix-conversion program and a postfix-
expression-evaluation program. We then modify the
postfix evaluation algorithm to generate machine-
language code. The compiler places this code in a file
(using the techniques of Chapter 1). Students then run
the machine language produced by their compilers on
the software simulators they built in the exercises of
Chapter 5! The 35 exercises include a supermarket
simulation using queueing, recursively searching a list,
recursively printing a list backwards, binary-tree node <br>
</page>
<page>
deletion, level-order traversal of a binary tree, printing
trees, writing a portion of an optimizing compiler,
writing an interpreter, inserting/deleting anywhere in a
linked list, implementing lists and queues without tail
pointers, analyzing the performance of binary tree
searching and sorting, and implementing an indexed list
class. Chapter 15 has been tuned up but not enhanced. It
is already a substantial, "down-deep" treatment of
building important data structures. After studying
Chapter 15, the reader is prepared for the treatment of
STL containers, iterators and algorithms in Chapter 20.
The STL containers are pre-packaged, templatized data
structures that most programs will find sufficient for the <br>
</page>
<page>
vast majority of applications they will need to
implement. STL is a giant leap forward in achieving the
vision of reuse, reuse, reuse.<br>
<font size=18><b>Chapter 16--Bits, Characters, Strings, and Structures--
</b></font><br>
presents a variety of important features. C++'s powerful
bit-manipulation capabilities enable programmers to
write programs that exercise lower-level hardware
capabilities. This helps programs process bit strings, set
individual bits on or off, and store information more
compactly. Such capabilities, often found only in low-
level assembly languages, are valued by programmers
writing system software such as operating systems and <br>
</page>
<page>
networking software. As you recall, we introduced C-
style <b>char *</b> string manipulation in Chapter 5 and
presented the most popular string-manipulation
functions. In Chapter 16, we continue our presentation
of characters and C-style <b>char *</b> strings. We present the
various character-manipulation capabilities of the <b>ctype</b>
library--these include the ability to test a character to
see if it is a digit, an alphabetic character, an
alphanumeric character, a hexadecimal digit, a
lowercase letter, an uppercase letter, etc. We present
the remaining string-manipulation functions of the
various string-related libraries; as always, every
function is presented in the context of a complete, <br>
</page>
<page>
working C++ program. Structures are like records in
Pascal and other languages--they aggregate data items
of various types. Structures are used in Chapter 14 to
form files consisting of records of information.
Structures are used in conjunction with pointers and
dynamic memory allocation in Chapter 15 to form
dynamic data structures such as linked lists, queues,
stacks, and trees. A feature of the chapter is its revised,
high-performance card shuffling and dealing
simulation. This is an excellent opportunity for the
instructor to emphasize the quality of algorithms. The
36 exercises encourage the student to try out most of
the capabilities discussed in the chapter. The feature <br>
</page>
<page>
exercise leads the student through the development of a
spell checker program. Chapters 15 and 1618 are
mostly the "C legacy" portion of C++. In particular, this
chapter presents a deeper treatment of C-like, <b>char *</b>
strings for the benefit of C++ programmers who are
likely to work with C legacy code. Again, Chapter 19
discusses class <b>string</b> and discusses manipulating
strings as full-fledged objects.<br>
<font size=18><b>Chapter 17--The Preprocessor--
</b></font><br>
provides detailed discussions of the preprocessor
directives. The chapter includes more complete
information on the <b>#include</b> directive that causes a
copy of a specified file to be included in place of the <br>
</page>
<page>
directive before the file is compiled, and the <b>#define</b>
directive that creates symbolic constants and macros.
The chapter explains conditional compilation for
enabling the programmer to control the execution of
preprocessor directives and the compilation of program
code. The <b>#</b> operator that converts its operand to a
string and the<b> ##</b> operator that concatenates two tokens
are discussed. The various predefined preprocessor
symbolic constants (<b>__LINE__</b>, <b>__FILE__</b>,
<b>__DATE__</b>, <b>__TIME__</b>, and <b>__STDC__</b>) are
presented. Finally, macro <b>assert</b> of the <b>assert.h</b> header
is discussed; <b>assert</b> is valuable in program testing,
debugging, verification, and validation. We have used <br>
</page>
<page>
<b>assert</b> in many examples, but the reader is urged to
begin using exception handling instead, as we
introduced in Chapter 13.<br>
<font size=18><b>Chapter 18--C Legacy Code Topics--
</b></font><br>
presents additional topics including several advanced
topics not ordinarily covered in introductory courses.
We show how to redirect input to a program to come
from a file, redirect output from a program to be placed
in a file, redirect the output of one program to be the
input of another program (piping), append the output of
a program to an existing file, develop functions that use
variable-length argument lists, pass command-line
arguments to function <b>main</b> and use them in a program, <br>
</page>
<page>
compile programs whose components are spread across
multiple files, register functions with <b>atexit</b> to be
executed at program termination, terminate program
execution with function <b>exit</b>, use the <b>const</b> and <b>volatile</b>
type qualifiers, specify the type of a numeric constant
using the integer and floating-point suffixes, use the
signal handling library to trap unexpected events, create
and use dynamic arrays with <b>calloc</b> and <b>realloc</b>, use
<b>union</b>s as a space-saving technique, and use linkage
specifications when C++ programs are to be linked with
legacy C code. As the title suggests, this chapter is
intended primarily for C++ programmers who will be
working with C legacy code.<br>
</page>
<page>
<font size=18><b>Chapter 19--Class string and String Stream Processing--
</b></font><br>
The chapter also discusses C++'s capabilities for
inputting data from strings in memory and outputting
data to strings in memory; these capabilities are often
referred to as in-core formatting or string-stream
processing. This chapter is completely new. Class
<b>string</b> is a required component of the Standard Library.
Although we placed this material in a chapter near then
end of the book, many instructors will want to
incorporate the discussion of "strings as full-fledged
objects" early in their courses. We preserved the
treatment of C-like strings in Chapter 5 and later for <br>
</page>
<page>
several reasons. First, we feel it strengthens the reader's
understanding of pointers. Second, we feel that for the
next decade, or so, C++ programmers will need to be
able to read and modify the enormous amounts of C
legacy code that have accumulated over the last quarter
of a century, and this code processes strings as pointers,
as does a large portion of the C++ code that has been
written in industry over the last many years. In Chapter
19 we discuss <b>string</b> assignment, concatenation and
comparison. We show how to determine various <b>string</b>
characteristics such as a <b>string</b>'s size, capacity and
whether or not it is empty. We discuss how to resize a
<b>string</b>. We consider the various <i>find</i> functions that <br>
</page>
<page>
enable us to find a substring in a <b>string</b> (searching the
<b>string</b> either forwards or backwards), and we show how
to find either the first occurrence or last occurrence of a
character selected from a <b>string</b> of characters, and how
to find the first occurrence or last occurrence of a
character that is not included in a <b>string</b>. We show how
to replace, erase and insert characters in a <b>string</b>. We
show how to convert a <b>string</b> object to a C-style <b>char *</b>
string.<br>
<font size=18><b>Chapter 20--Standard Template Library (STL)--
</b></font><br>
This chapter is completely new. It is a "feature chapter"
of this edition, as should be clear from the prominence
we have given STL on the cover. We emphasize here <br>
</page>
<page>
again that this is not an STL book, nor is there any
discussion of actual STL features in the first 18
chapters. Chapter 19 does make brief mention of
iterators, but states that the real discussion of iterators is
in Chapter 20. With the inclusion of Chapter 20, <i>C++
How to Program: Second Edition</i> now discusses four
programming paradigms: procedural programming,
object-based programming, object-oriented
programming and generic programming (with STL).
The challenges of teaching object-oriented
programming will increase as class libraries and class
template libraries grow. We believe that there will be
exponential growth in reusable componentry over the <br>
</page>
<page>
next few decades. The early computer science
curriculum will need to present the root language,
indicate how to craft valuable classes, overview key
existing class libraries, and show how to reuse these
components. Upper-level computer science courses,
and, in fact, courses in most any topic for which
computers are used (i.e., today that means most any
topic, period) will cover their bodies of knowledge and
these will include discussion and use of the class
libraries that apply to that subject area. Many efforts are
underway to support reuse across platforms, so it will
not matter what language your classes are written in, <br>
</page>
<page>
you will be able to reuse them from many different
languages.<br>
<font size=18><b>Chapter 21--ANSI/ISO C++ Standard Language
Additions--
</b></font><br>
This chapter is completely new. It is a collection of
miscellaneous additions to the language. We discuss
data type <b>bool</b> with data values <b>false</b> and <b>true</b>--a more
natural representation than using non-zero and zero
values (although these may still be used). We discuss
the four new cast operators: <b>static_cast</b>, <b>const_cast</b>,
<b>reinterpret_cast</b> and <b>dynamic_cast</b>. These provide a
much more robust mechanism for dealing with casts
than the style of casts C++ inherited from C. We discuss <br>
</page>
<page>
<b>namespaces</b>, a feature particularly crucial for software
developers building substantial systems, especially
when using a variety of class libraries. Namespaces
prevent the kinds of naming collisions that previously
hindered such large software efforts. We consider run-
time type information (RTTI) which allows programs to
check the type of an object, something they could not
do previously unless the programmer explicitly
included a type code (an undesirable programming
practice). We discuss the use of operators <b>typeid</b> and
<b>dynamic_cast</b>. We discuss the new operator keywords;
these are useful for programmers who do not like
cryptic operators, but their primary use is in <br>
</page>
<page>
international markets where certain characters are not
normally available on local keyboards. We consider the
use of keyword <b>explicit</b> that prevents the compiler from
invoking conversion constructors when it would be
undesirable to do so; <b>explicit</b> conversion constructors
can only be invoked through constructor syntax, not
through implicit conversions. We discuss keyword
<b>mutable</b>, which allows a member of a <b>const</b> object to
be changed. Previously this was accomplished by
"casting away <b>const</b>-ness," a dangerous practice. We
also discuss a few features that are not new, but which
we chose not to include in the main portion of the book,
because they are relatively obscure, namely pointer-to-<br>
</page>
<page>
member operators <b>.*</b> and <b>->*</b> and using <b>virtual</b> base
classes with multiple inheritance.<br>
newtitle
<b>Appendix A--Operator Precedence Chart--
</b>
<b><b>Appendix A--Operator Precedence Chart--
</b></b><br>
We have reformatted the table to be more useful. Each
operator is now on a line by itself with the operator
symbol, its name and its associativity.<br>
<font size=18><b>Appendix B--ASCII Character Set--
</b></font><br>
We resisted the temptation to expand this substantially
to include the relatively new international Unicode
character set. By the next edition, we expect to discuss
Unicode in detail.<br>
</page>
<page>
<font size=18><b>Appendix C--Number Systems--
</b></font><br>
discusses the binary, octal, decimal and hexadecimal
number systems. It considers how to convert numbers
between bases and explains the one's complement and
two's complement binary representations.<br>
<font size=18><b>Appendix D--C++ Internet and Web Resources--
</b></font><br>
contains a huge listing of valuable C++ resources such
as demos, information about popular compilers
(including freebies), books, articles, conferences, job
banks, journals, magazines, help, tutorials, FAQs
(frequently asked questions), newsgroups, copies of the
ANSI/ISO C++ Draft Standard document, web-based
courses, product news and C++ development tools.<br>
</page>
<page>
<font size=18><b>Bibliography--
</b></font><br>
lists 122 books and articles--some of historical interest
and most quite recent--to encourage the student to do
further reading on C++ and OOP.<br>
<font size=18><b>Index--
</b></font><br>
The book contains a comprehensive index to enable the
reader to locate by keyword any term or concept
throughout the text.<br>
</page>
</section>
<section type=Body name=Default title="The C & C++ Multimedia Cyber Classroom: Second Edition">
<page>
<font size=18 bold>The C & C++ Multimedia Cyber Classroom:
Second Edition</font><hr>
We have implemented an interactive, CD-ROM-based,
software version of <i>C++ How to Program: Second
Edition </i>called the <i>C & C++ Multimedia Cyber
Classroom: Second Edition. </i>It is loaded with features
for learning and reference. The <i>Cyber Classroom</i> is
wrapped with the textbook in a publication called <i>The
Complete C++ Training Course: Second Edition</i>. If
you have already purchased the textbook, you can get a
copy of the<i> C & C++ Multimedia Cyber Classroom</i> CD <br>
</page>
<page>
directly from Prentice Hall. Please see the ordering
instructions on the last few pages of this book.<br>
<spacer width=16 height=1>There is an introductory video with the authors
overviewing the Cyber Classroom's features. The 248
live-code example C++ programs in the textbook truly
"come alive" in the <i>C & C++ Multimedia Cyber
Classroom</i>. We have placed executables for all these
examples "under the hood" of the <i>C & C++
Multimedia Cyber Classroom</i>, so if you are viewing a
program and want to execute it, you simply click on the
lightning bolt icon and the program will run. You will
immediately see--and hear (for the audio-based
multimedia programs)--the program's outputs. If you <br>
</page>
<page>
want to modify a program and see the effects of your
changes, simply click on the floppy-disk icon that
causes the source code to be "lifted off" the CD and
"dropped into" one of your own directories so you can
edit the text, recompile the program and try out your
new version. Click on the audio icon and Paul Deitel
will talk about the program and "walk you through" the
code. (You will not hear Harvey Deitel's voice in these
audios--our friends at Prentice Hall like Paul's voice
better!) <br>
<spacer width=16 height=1>The <i>C & C++ Multimedia Cyber Classroom</i> provides
various navigational aids including extensive
hyperlinking. The <i>C & C++ Multimedia Cyber
</i><br>
</page>
<page>
<i>Classroom</i> remembers in a "history list" recent sections
you have visited and allows you to move forward or
backward in that history list. The thousands of index
entries are hyperlinked to their text occurrences. You
can key in a term and the <i>C & C++ Multimedia Cyber
Classroom</i> will locate its occurrences throughout the
text. The <i>Table of Contents</i> entries are "hot," so clicking
on a chapter or section name immediately takes you to
that chapter or section. You can insert "bookmarks" at
places to which you may want to return. You can even
add "notes" just as you would in the margin of a
textbook.<br>
</page>
<page>
These second edition Cyber Classrooms have been
completely reprogrammed in Java to run on multiple
platforms. Windows(tm) 95, Windows NT(tm) and
Solaris(tm) are currently compatible, and Macintosh\xa8
OS/8 is expected to be supported later in 1998.<br>
<spacer width=16 height=1>Students and professional users of our <i>Cyber
Classrooms</i> tell us they like the interactivity and that
the <i>Cyber Classroom</i> is an effective reference because
of the extensive hyperlinking and other navigational
features. We recently had an email from a person who
said that he lives "in the boonies" and cannot take a live <br>
</page>
<page>
course at a college, so the <i>Cyber Classroom</i> was a nice
solution to his educational needs.<br>
<spacer width=16 height=1>Professors have sent us emails indicating their students
enjoy using the <i>Cyber Classroom</i>, spend more time on
the course and master more of the material than in
textbook-only courses. Also, the <i>Cyber Classroom</i>
helps shrink lines outside professors' offices during
office hours. We have also published the <i>Java
Multimedia Cyber Classroom</i> and hope to publish
<i>Cyber Classroom</i> editions of our forthcoming
Microsoft-related <i>Visual Basic</i>(r)<i> How to Program,</i> <br>
</page>
<page>
<i>Visual C++</i>(r)<i> How to Program and Visual J++</i>(tm)<i>
How to Program </i>textbooks.<br>
</page>
</section>
<section type=Body name=Default title="Acknowledgments">
<page>
<font size=18 bold>Acknowledgments</font><hr>
One of the great pleasures of writing a textbook is
acknowledging the efforts of many people whose
names may not appear on the cover, but whose hard
work, cooperation, friendship, and understanding were
crucial to the production of the book.<br>
<spacer width=16 height=1>Three other people at Deitel & Associates, Inc. devoted
long hours to this project. We would like to
acknowledge the efforts of Tem Nieto, Barbara Deitel
and Abbey Deitel. <br>
<spacer width=16 height=1>Tem Nieto, a graduate of the Massachusetts Institute of
Technology, is one of our full-time colleagues at Deitel <br>
</page>
<page>
& Associates, Inc. Tem teaches C++, C and Java
seminars and works with us on textbook writing, course
development and multimedia authoring efforts. He is
co-authoring our forthcoming book, <i>Visual Basic How
to Program</i>. Tem co-authored Chapter 19, Chapter 21
and the Special Section entitled "Building Your Own
Compiler" in Chapter 15. He also contributed to the
Instructor's Manual and the<i> C & C++ Multimedia
Cyber Classroom: Second Edition</i>.<br>
<spacer width=16 height=1>Barbara Deitel managed the preparation of the
manuscript and coordinated with Prentice Hall all the
efforts related to production of the book. Barbara's
efforts are by far the most painstaking of what we do to <br>
</page>
<page>
develop books. She has infinite patience. She handled
the endless details involved in publishing a 1200-page,
two-color book; a 500-page instructor's manual and the
650 megabyte CD <i>C & C++ Multimedia Cyber
Classroom.</i> She used FrameMaker page-layout
software to prepare the book. Barbara mastered this
complex software package and did a marvelous job
giving the book its clean style. She spent long hours
researching the quotations at the beginning of each
chapter. She prepared every one of the 7800 page
references in the 39-page index. She did all this in
parallel with handling her extensive financial and <br>
</page>
<page>
administrative responsibilities at Deitel & Associates,
Inc. <br>
<spacer width=16 height=1>Abbey Deitel, a graduate of Carnegie Mellon
University's industrial management program, and now
Chief Operating Officer and Director of Worldwide
Marketing at Deitel & Associates, Inc., wrote Appendix
D and suggested the title for the book. We asked Abbey
to surf the World Wide Web and track down the best
C++ sites. She used every major Web search engine and
collected this information for you in Appendix D. For
each resource and demo, Abbey has provided a brief
explanation. She rejected hundreds of sites and has
listed for you the best she could find. Abbey will be <br>
</page>
<page>
keeping this resources and demos listing on our Web
site <b>http://www.deitel.com</b>. She asks that you send
URLs for your favorite sites to her by email at
<b>deitel@deitel.com</b> and she will post links to these on
our site.<br>
<spacer width=16 height=1>We are fortunate to have been able to work on this
project with a talented and dedicated team of publishing
professionals at Prentice Hall. This book happened
because of the encouragement, enthusiasm, and
persistence of our computer science editor, Laura
Steele, and her boss--the best friend we have had in 22
years of publishing--Marcia Horton, Editor-in-Chief of
Prentice-Hall's Engineering and Computer Science <br>
</page>
<page>
Division. Camille Trentacoste did a marvelous job as
production manager. <br>
<spacer width=16 height=1>The <i>C & C++ Multimedia Cyber Classroom: Second
Edition </i>was developed in parallel with <i>C++ How to
Program: Second Edition</i>. We sincerely appreciate the
"new media" insight, savvy and technical expertise of
our editor Mark Taub. He did a remarkable job bringing
the <i>C & C++ Multimedia Cyber Classroom: Second
Edition,</i> to publication under a tight schedule. Mark is
surely one of the world's leaders in new-media
publishing. We also want to thank Logan Campbell,
President of the Prentice Hall Professional and <br>
</page>
<page>
Technical Reference Division, for making impressive
resources available to our projects.<br>
<spacer width=16 height=1>We owe special thanks to the creativity of Tamara
Newnam Cavallo who did the art work for our
programming tips icons and the cover. She created the
delightful creature who shares with you the book's
programming tips. Please help us name this endearing
little bug. Some early suggestions: D. Bug, InterGnat,
DeetleBug (an unfortunate moniker that was attached to
the old guy in high school) and Feature (It's not a bug,
it's a feature"). <br>
</page>
<page>
We sincerely appreciate the efforts of our reviewers
(some first edition, some second edition, and some
both):<br>
<font size=6><br></font><indent width=16><font size=14><i>Richard Albright (University of Delaware) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Ken Arnold (Sun Microsystems)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Ian Baker (Microsoft) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Pete Becker (Member of ANSI/ISO C++ Committee; Dinkumware, LTD.)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Timothy D. Born (Delta C-Fax) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>John Carson (George Washington University) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Steve Clamage (Chairman of ANSI/ISO C++ Standards
Committee; Sunsoft)</i></font></indent><font size=6><br></font>
</page>
<page>
<font size=6><br></font><indent width=16><font size=14><i>Marian Corcoran (Member ANSI/ISO C++ Standards
Committee)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Edgar Crisostomo (Siemens/Rolm) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>David Finkel (Worcester Polytechnic Institute)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Rex Jaeschke (Chairman, ANSI/ISO C Committee)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Frank Kelbe (Naval Postgraduate School) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Chris Kelsey (Kelsey Associates) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Don Kostuch (You Can C Clearly Now)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Meng Lee (Co-creator of STL; Hewlett-Packard)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Barbara Moo (AT&T Bell Labs) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>David Papurt (Consultant)</i></font></indent><font size=6><br></font>
</page>
<page>
<font size=6><br></font><indent width=16><font size=14><i>Wolfgang Pelz (University of Akron) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Jandelyn Plane (University of Maryland College Park) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Paul Power (Borland) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Kenneth Reek (Rochester Institute of Technology)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Larry Rosler (Hewlett-Packard) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Robin Rowe (Halycon/Naval Postgraduate School)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Brett Schuchert (ObjectSpace; Co-Authored <i>STL Primer</i>) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Alexander Stepanov (Co-creator of STL; Silicon Graphics) </i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>William Tepfenhart (AT&T; Author <i>UML and C++: A
Practical Guide to Object-Oriented Development</i>)</i></font></indent><font size=6><br></font>
</page>
<page>
<font size=6><br></font><indent width=16><font size=14><i>David Vandevoorde (Member of the ANSI/ISO C++
Committee; HewlettPackard)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Terry Wagner (University of Texas) </i></font></indent><font size=6><br></font>
Under tight deadlines, they scrutinized every aspect of
the text and made countless suggestions for improving
the accuracy and completeness of the presentation.<br>
<spacer width=16 height=1>We would sincerely appreciate your comments,
criticisms, corrections, and suggestions for improving
the text. Please send your suggestions for improving
and adding to our list of <i>Good Programming Practices,
Common Programming Errors, Performance Tips,
Portability Tips,</i> <i>Software Engineering Observations</i>, <br>
</page>
<page>
and <i>Testing and Debugging Tips. </i>Please address all
correspondence to our email address:<br>
<font size=2><br></font><font size=11><pre>
deitel@deitel.com<p>
</pre></font>
or write to us as follows:<br>
<font size=6><br></font><indent width=16><font size=14><i>Harvey M. Deitel (author)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Paul J. Deitel (author)</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>c/o Computer Science Editor, ESM</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Prentice Hall</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>1 Lake Street</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Upper Saddle River, NJ 07458</i></font></indent><font size=6><br></font>
</page>
<page>
We will respond immediately. Well, that's it for now.
Welcome to the exciting world of C++, object-oriented
programming and generic programming with STL. We
hope you enjoy this look at contemporary computer
programming. Good luck!<br>
<font size=6><br></font><indent width=16><font size=14><i>Dr. Harvey M. Deitel</i></font></indent><font size=6><br></font>
<font size=6><br></font><indent width=16><font size=14><i>Paul J. Deitel</i></font></indent><font size=6><br></font>
</page>
</section>
<section type=Body name=Default title="About the Authors">
<page>
<font size=18 bold>About the Authors</font><hr>
<b>Dr. Harvey M. Deitel</b>, CEO of Deitel & Associates,
Inc., has 36 years experience in the computing field
including extensive industry and academic experience.
He is one of the world's leading computer science
instructors and seminar presenters. Dr. Deitel earned
B.S. and M.S. degrees from the Massachusetts Institute
of Technology and a Ph.D. from Boston University. He
worked on the pioneering virtual memory operating
systems projects at IBM and MIT that developed
techniques widely implemented today in systems like
UNIX(r), Windows NT(tm) and OS/2. He has 20 years of <br>
</page>
<page>
college teaching experience including earning tenure
and serving as the Chairman of the Computer Science
Department at Boston College before founding Deitel
& Associates, Inc. with Paul J. Deitel. He is author or
co-author of several dozen books and multimedia
packages and is currently writing five more. With
translations published in Japanese, Russian, Spanish,
Elementary Chinese, Advanced Chinese, Korean, and
French, the Deitels' texts have earned international
recognition.<br>
<spacer width=16 height=1><b>Paul J. Deitel</b>, Executive Vice President of Deitel &
Associates, Inc., is a graduate of the Massachusetts
Institute of Technology's Sloan School of Management <br>
</page>
<page>
where he studied Information Technology. Through
Deitel & Associates, Inc. he has delivered Java, C and
C++ courses for industry clients including Digital
Equipment Corporation, Sun Microsystems, White
Sands Missile Range, Rogue Wave Software, Software
2000, Computervision, Stratus, Fidelity, Cambridge
Technology Partners, Open Environment Corporation,
One Wave, Hyperion Software, Lucent Technologies,
Adra Systems, Entergy, CableData Systems, NASA at
the Kennedy Space Center, the National Severe Storm
Center, IBM and many other organizations. He has
lectured on C++ and Java for the Boston Chapter of the
Association for Computing Machinery. He teaches <br>
</page>
<page>
satellite-based Java courses through a cooperative
venture of Deitel & Associates, Inc., Prentice Hall and
the Technology Education Network. He is the co-author
of ten books and multimedia packages with Harvey
Deitel and is currently writing five more.<br>
<spacer width=16 height=1>The Deitels are co-authors of the world's best-selling
introductory college computer science textbooks, <i>C
How to Program</i>, <i>C++ How to Program</i> and <i>Java How
to Program</i>. The Deitels are also co-authors of the C &
C++ Multimedia Cyber Classroom--Prentice Hall's
first multimedia-based textbook--and the <i>Java
Multimedia Cyber Classroom</i>. Each of these textbooks
and <i>Cyber Classrooms</i> is in its second edition.<br>
</page>
</section>
<section type=Body name=Default title="About Deitel & Associates, Inc.">
<page>
<font size=18 bold>About Deitel & Associates, Inc.</font><hr>
Deitel & Associates, Inc. is a rapidly growing,
internationally recognized corporate training and
publishing organization specializing in programming
languages and object technology education. The
company provides courses on C++, Java, C, Visual
Basic, and Object-Oriented Analysis and Design. The
principals of Deitel & Associates, Inc. are Dr. Harvey
M. Deitel and Paul J. Deitel. The company's clients
include some of the world's largest computer
companies, government agencies and business
organizations. Through its publishing partnership with <br>
</page>
<page>
Prentice Hall, Deitel & Associates, Inc. publishes
leading-edge programming textbooks and professional
books, interactive CD-ROM-based multimedia <i>Cyber
Classrooms </i>and satellite courses. The company will
soon begin publishing videotape courses and World-
Wide-Web-based courses. Deitel & Associates, Inc. and
the authors can be reached via email at <br>
<font size=2><br></font><font size=11><pre>
deitel@deitel.com<p>
</pre></font>
To learn more about Deitel & Associates, Inc. and its
on-site course curriculum, visit:<br>
<font size=2><br></font><font size=11><pre>
http://www.deitel.com<p>
</pre></font>
</page>
<page>
To learn more about Deitel/Prentice Hall publications,
visit:<br>
<font size=2><br></font><font size=11><pre>
http://www.prenhall.com/deitel<p>
</pre></font>
For a current list of Deitel/Prentice Hall publications
including textbooks and multimedia packages, and for
complete worldwide ordering information, please see
the last few pages of this book.<br>
<br>
</page>
</section>
<section type=Popup name=Quotes title="Quotes">
<page>
This chapter does not contain any Quotes.
</page>
</section>
<section type=Popup name=Answers title="Answers">
<page>
This chapter does not contain any Answers to Exercises.
</page>
</section>
<section type=Popup name=Debug title="Testing">
<page>
This chapter does not contain any Testing and Debugging tips.
</page>
</section>
<section type=Popup name=Terminology title="Terminology">
<page>
This chapter does not contain any Terminology links.
</page>
</section>
<section type=Popup name=Portable title="Portability">
<page>
This chapter does not contain any Portability tips.
</page>
</section>
<section type=Popup name=Illustration title="Illustrations">
<page>
This chapter does not contain any Illustrations.
</page>
</section>
<section type=Popup name=AppletPopup title="Applet Examples">
<page>
This chapter does not contain any Applet Examples.
</page>
</section>
<section type=Popup name=Perform title="Performance">
<page>
This chapter does not contain any Performance tips.
</page>
</section>
<section type=Popup name=Practice title="Good Practices">
<page>
This chapter does not contain any Good Programming Practices tips.
</page>
</section>
<section type=Popup name=Objective title="Objectives">
<page>
This chapter does not contain any Objectives.
</page>
</section>
<section type=Popup name=Code title="Code Examples">
<page>
This chapter does not contain any Code Examples.
</page>
</section>
<section type=Popup name=Exercises title="Exercises">
<page>
This chapter does not contain any Exercises.
</page>
</section>
<section type=Popup name=Engineer title="Engineering">
<page>
This chapter does not contain any Software Engineering Observations.
</page>
</section>
<section type=Popup name=Errors title="Common Errors">
<page>
This chapter does not contain any Common Errors tips.
</page>
</section>
</chapter>
</html>
</html>